package com.gt.quality.system.entity.vo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.gt.quality.base.UserSexEnum;
import com.gt.quality.base.pojo.BasePage;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @description: 用户列表查询
 * @author: makeJava
 * @createTime: 2026-12-22 19:33
 * @since JDK21
 **/
@EqualsAndHashCode(callSuper = true)
@Data
@Schema(title = "用户查询接口参数", description = "用户查询接口参数")
public class QueryWhereUser extends BasePage {

    /**
     * Description:  用户账号
     */
    @Schema(title = "user_name", description = "用户账号")
    private String userName;

    /**
     * Description:  用户昵称
     */
    @Schema(title = "nick_name", description = "用户昵称")
    private String nickName;

    /**
     * Description:  用户类型（sys_user系统用户）
     */
    @Schema(title = "user_type", description = "用户类型（sys_user系统用户）")
    private String userType;

    /**
     * Description:  用户性别（0男 1女 2未知）
     */
    @TableField(value = "sex")
    @Schema(title = "sex", description = "用户性别（0男 1女 2未知）")
    private String sex;


    /**
     * Description:  帐号状态（0正常 1停用）
     */
    @Schema(title = "status", description = "帐号状态（0正常 1停用）")
    private String status;

    /**
     * 部门查询
     */
    @Schema(title = "deptId", description = "根据部门查询用户")
    private Long deptId;

    public String getDbSex() {
        UserSexEnum sexEnum = UserSexEnum.buildSexInfo(sex);
        return sexEnum.equals(UserSexEnum.Default) ? null : sexEnum.getCode().toString();
    }
}
